/**
 * This code is released under lgpl v3 license.
 * All rights reserved.
*/

package net.gfbridge.demo.client;

import bridge.FABridgeInstance;
import bridge.FABridgeWrapper;
import bridge.InitCallback;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.RootPanel;
import pl.rmalinowski.gwt2swf.client.ui.SWFWidget;

/**
 *
 * @author yuan yunchang    dukerr@gmail.com
 */
public class InitCallbackDemo implements  EntryPoint{
    String bridgeName = "initTest";
    public void onModuleLoad() {
        String baseUrl =GWT.getModuleBaseURL();
        SWFWidget swf = new SWFWidget(baseUrl+"EmptyFABridgeSWF.swf", "0px", "0px");
        swf.addFlashVar("bridgeName", bridgeName);
        RootPanel.get("init-demo").add(swf);
        FABridgeWrapper.get().addInitCallback(bridgeName, new InitCallback() {

            public void initComplete(FABridgeInstance inst) {
                String name = inst.getName();
                Window.alert("we can get FABridge init complete event in java\n" +
                        "this is bridge name:"+name);
            }
        });
    }

}
